/**
 * Alipay.com Inc.
 * Copyright (c) 2004-2015 All Rights Reserved.
 */
package com.zb.jnlxc.service;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 *
 * @author zhengbo.zb
 * @version $Id: RecordForOld.java, v 0.1 2015-05-23 15:23 zhengbo.zb Exp $
 */
public class RecordForOld {
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        String JsonContext = ReadFile("D:\\TZ.json");
    }

    public static String ReadFile(String Path){
        BufferedReader reader = null;
        String laststr = "";
        try{
            FileInputStream fileInputStream = new FileInputStream(Path);
            InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "UTF-8");
            reader = new BufferedReader(inputStreamReader);
            String tempString = null;
            int a=1;
            while((tempString = reader.readLine()) != null){

                if(tempString.contains("},")){
                    laststr += "}";
                    JSONObject o = JSON.parseObject(laststr);
                    System.out.println(o.toJSONString());
                    laststr="";
                }else {
                    laststr += tempString;
                }
            }
            reader.close();
            System.out.println("文件读取完毕");
        }catch(IOException e){
            e.printStackTrace();
        }finally{
            if(reader != null){
                try {
                    reader.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
        return laststr;
    }
}
